package MaxInterface;


import javax.swing.JButton;
import java.awt.Dimension;
import java.awt.event.KeyEvent;
import javax.swing.JTable;

import com.dukascopy.api.IAccount;
import com.dukascopy.api.IBar;
import com.dukascopy.api.IContext;
import com.dukascopy.api.IMessage;
import com.dukascopy.api.IStrategy;
import com.dukascopy.api.ITick;
import com.dukascopy.api.Instrument;
import com.dukascopy.api.JFException;
import com.dukascopy.api.Period;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import javax.swing.JDialog;
import javax.swing.SwingConstants;
import java.awt.Panel;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import javax.swing.JWindow;
import java.awt.Frame;
import java.awt.FlowLayout;
import java.awt.Color;
import java.awt.Rectangle;
import javax.swing.JScrollPane;
import javax.swing.JLabel;
import java.awt.CardLayout;
import java.awt.GridLayout;
import javax.swing.ListSelectionModel;
import java.awt.Insets;

public class MainPanel{

	private JFrame jFrame = null;  //  @jve:decl-index=0:visual-constraint="95,41"
	private JPanel jContentPane = null;
	private JTable jTable = null;
	private JPanel jPanel = null;
	private JButton jButton1 = null;
	private JButton jButton4 = null;
	private JButton jButton2 = null;
	private JButton jButton3 = null;
	private JLabel jLabel = null;
	private JFrame jFrame1 = null;  //  @jve:decl-index=0:visual-constraint="195,32"
	/**
	 * This method initializes jFrame	
	 * 	
	 * @return javax.swing.JFrame	
	 */
	
	public MainPanel(){
		getJFrame1();
	}
	/*
	private JFrame getJFrame() {
		if (jFrame == null) {
			jFrame = new JFrame();
			jFrame.setSize(new Dimension(983, 454));
			jFrame.setContentPane(getJContentPane());
		}
		return jFrame;
	}
	*/
	/**
	 * This method initializes jContentPane	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
			gridBagConstraints2.gridx = 0;
			gridBagConstraints2.anchor = GridBagConstraints.WEST;
			gridBagConstraints2.fill = GridBagConstraints.NONE;
			gridBagConstraints2.gridy = 2;
			jLabel = new JLabel();
			jLabel.setText("Broker connection");
			GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
			gridBagConstraints1.insets = new Insets(3, 3, 3, 3);
			gridBagConstraints1.gridy = 0;
			gridBagConstraints1.ipadx = 0;
			gridBagConstraints1.ipady = 0;
			gridBagConstraints1.fill = GridBagConstraints.NONE;
			gridBagConstraints1.anchor = GridBagConstraints.NORTH;
			gridBagConstraints1.gridx = 2;
			GridBagConstraints gridBagConstraints = new GridBagConstraints();
			gridBagConstraints.fill = GridBagConstraints.BOTH;
			gridBagConstraints.gridx = 0;
			gridBagConstraints.gridy = 0;
			gridBagConstraints.ipadx = 0;
			gridBagConstraints.ipady = 0;
			gridBagConstraints.weightx = 1.0;
			gridBagConstraints.weighty = 1.0;
			gridBagConstraints.insets = new Insets(2, 2, 2, 2);
			jContentPane = new JPanel();
			jContentPane.setLayout(new GridBagLayout());
			jContentPane.add(getJTable(), gridBagConstraints);
			jContentPane.add(getJPanel(), gridBagConstraints1);
			jContentPane.add(jLabel, gridBagConstraints2);
		}
		return jContentPane;
	}

	/**
	 * This method initializes jTable	
	 * 	
	 * @return javax.swing.JTable	
	 */
	private JTable getJTable() {
		if (jTable == null) {
			jTable = new JTable();
			jTable.setCellSelectionEnabled(false);
			jTable.setRowSelectionAllowed(false);
			jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
			jTable.setShowGrid(true);
			jTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
		}
		return jTable;
	}
	/**
	 * This method initializes jPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel() {
		if (jPanel == null) {
			GridLayout gridLayout = new GridLayout();
			gridLayout.setRows(4);
			gridLayout.setHgap(2);
			gridLayout.setVgap(4);
			gridLayout.setColumns(1);
			jPanel = new JPanel();
			jPanel.setLayout(gridLayout);
			jPanel.add(getJButton1(), null);
			jPanel.add(getJButton2(), null);
			jPanel.add(getJButton3(), null);
			jPanel.add(getJButton4(), null);
		}
		return jPanel;
	}
	/**
	 * This method initializes jButton1	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton1() {
		if (jButton1 == null) {
			jButton1 = new JButton();
			jButton1.setVerticalAlignment(SwingConstants.CENTER);
			jButton1.setText("Add trading panel");
			jButton1.setVerticalTextPosition(SwingConstants.CENTER);
		}
		return jButton1;
	}
	/**
	 * This method initializes jButton4	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton4() {
		if (jButton4 == null) {
			jButton4 = new JButton();
			jButton4.setVerticalAlignment(SwingConstants.CENTER);
			jButton4.setText("Perfomance Stats");
			jButton4.setVerticalTextPosition(SwingConstants.CENTER);
		}
		return jButton4;
	}
	/**
	 * This method initializes jButton2	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton2() {
		if (jButton2 == null) {
			jButton2 = new JButton();
			jButton2.setVerticalAlignment(SwingConstants.CENTER);
			jButton2.setText("Settings");
			jButton2.setVerticalTextPosition(SwingConstants.CENTER);
		}
		return jButton2;
	}
	/**
	 * This method initializes jButton3	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton3() {
		if (jButton3 == null) {
			jButton3 = new JButton();
			jButton3.setText("Dashboard");
			jButton3.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					//System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
					Dashboard_2 DashB = new Dashboard_2(); 
				}
			});
		}
		return jButton3;
	}
	/**
	 * This method initializes jFrame1	
	 * 	
	 * @return javax.swing.JFrame	
	 */
	private JFrame getJFrame1() {
		if (jFrame1 == null) {
			jFrame1 = new JFrame();
			jFrame1.setSize(new Dimension(715, 323));
			jFrame1.setTitle("MAX Trading Interface");
			jFrame1.setVisible(true);
			jFrame1.setContentPane(getJContentPane());
		}
		return jFrame1;
	}

}
